home *** CD-ROM | disk | FTP | other *** search
- Path: news.rain.org!usenet
- From: "Guus Leeuw jr." <guusl@eiffel.com>
- Newsgroups: comp.lang.c++
- Subject: Re: Truncate binaryfile at a special position
- Date: Tue, 12 Mar 1996 13:33:31 -0800
- Organization: Interactive Software Engineering Inc. http://www.eiffel.com/
- Message-ID: <3145EDAB.37732C37@eiffel.com>
- References: <314437C0.41C67EA6@theoinf.tu-ilmenau.de> <4i2vu2$psp@sam.inforamp.net>
- NNTP-Posting-Host: @outback.eiffel.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (X11; I; Linux 1.2.8 i586)
-
- Randy Charles Morin wrote:
- >
- > In article <314437C0.41C67EA6@theoinf.tu-ilmenau.de>,
- > Gregor Gaertner <gregor.gaertner@theoinf.tu-ilmenau.de> wrote:
- > >I have the following problem:
- > >I have a file, where the last 200 bytes are useless. No I want to
- > >truncate the last 200 bytes, but I don't know how to realize this with
- > >the help of the streamclasses in C++. The way to copy the part until the
- > >useless bytes to a new file is not acceptable for me, because if the
- > >file is 20 Mb long and I want only to cut 200 bytes from the end, I need
- > >with this insufficient method 20Mb free space more on the harddisc total
- > >because of the copy.
- > >Can anyone help ???
- >
- > Have you tried something like
- >
- > ofstream os(filename);
- > os.seekp(200, end);
- > os << endl;
- >
- > or
- >
- > ofstream os(filename);
- > os.seekp(200, end);
- > os.ignore(200);
- >
- > Just a few suggestion, I don't know if they works.
-
- Have you tried them????
-
- Basically you're somebody on the wrong way: ofstream doesn't define ignore(int).
- It is a member function of class istream and meant to ignore the next several
- characters on that input stream...
-
- > Actually, I doubt the first one words.
-
- Of course would the first one not work.
-
- This is not meant to give you hard time, but you should realy try your suggestions
- before posting them.
-
- Regards,
- Guus
-